<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WiFi Host Driver Board Support Package Integration (whd-bsp-integration)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">WiFi Host Driver Board Support Package Integration (whd-bsp-integration)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__bsp__network__buffer.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Buffer management</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >NetX Duo specific APIs for dealing with network packet buffers. </p>
<p >Basic set of APIs for dealing with network packet buffers.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga8aa3a6c010a110639b3cd53f86a7e349"><td class="memItemLeft" align="right" valign="top"><a id="ga8aa3a6c010a110639b3cd53f86a7e349" name="ga8aa3a6c010a110639b3cd53f86a7e349"></a>
typedef NX_PACKET *(*&#160;</td><td class="memItemRight" valign="bottom"><b>cy_dynamic_buffer_allocate_t</b>) (uint16_t payload_size)</td></tr>
<tr class="memdesc:ga8aa3a6c010a110639b3cd53f86a7e349"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for allocating a dynamic packet. <br /></td></tr>
<tr class="separator:ga8aa3a6c010a110639b3cd53f86a7e349"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae058fc994c2d0d8c9960e68bbae86258"><td class="memItemLeft" align="right" valign="top"><a id="gae058fc994c2d0d8c9960e68bbae86258" name="gae058fc994c2d0d8c9960e68bbae86258"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>cy_dynamic_buffer_free_t</b>) (NX_PACKET *packet)</td></tr>
<tr class="memdesc:gae058fc994c2d0d8c9960e68bbae86258"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function for releasing a dynamic packet. <br /></td></tr>
<tr class="separator:gae058fc994c2d0d8c9960e68bbae86258"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga71ccfd14f0c40804d555ccfb901b9d4f"><td class="memItemLeft" align="right" valign="top">whd_result_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga71ccfd14f0c40804d555ccfb901b9d4f">cy_buffer_enable_dynamic_buffers</a> (<a class="el" href="group__group__bsp__network__buffer.html#ga8aa3a6c010a110639b3cd53f86a7e349">cy_dynamic_buffer_allocate_t</a> buffer_allocate, <a class="el" href="group__group__bsp__network__buffer.html#gae058fc994c2d0d8c9960e68bbae86258">cy_dynamic_buffer_free_t</a> buffer_free)</td></tr>
<tr class="memdesc:ga71ccfd14f0c40804d555ccfb901b9d4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable dynamic buffers for IOCTLs requiring large buffers.  <a href="group__group__bsp__network__buffer.html#ga71ccfd14f0c40804d555ccfb901b9d4f">More...</a><br /></td></tr>
<tr class="separator:ga71ccfd14f0c40804d555ccfb901b9d4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6f5114fb8aa816f28ccb6370507c36c4"><td class="memItemLeft" align="right" valign="top">whd_result_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga6f5114fb8aa816f28ccb6370507c36c4">cy_buffer_pool_init</a> (void *tx_packet_pool, void *rx_packet_pool)</td></tr>
<tr class="memdesc:ga6f5114fb8aa816f28ccb6370507c36c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the buffer pools.  <a href="group__group__bsp__network__buffer.html#ga6f5114fb8aa816f28ccb6370507c36c4">More...</a><br /></td></tr>
<tr class="separator:ga6f5114fb8aa816f28ccb6370507c36c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga216b4943aa8bcffd6eb685ce7c2b6a95"><td class="memItemLeft" align="right" valign="top">whd_result_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga216b4943aa8bcffd6eb685ce7c2b6a95">cy_host_buffer_get</a> (whd_buffer_t *buffer, whd_buffer_dir_t direction, uint16_t size, uint32_t timeout_ms)</td></tr>
<tr class="memdesc:ga216b4943aa8bcffd6eb685ce7c2b6a95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates a packet buffer.  <a href="group__group__bsp__network__buffer.html#ga216b4943aa8bcffd6eb685ce7c2b6a95">More...</a><br /></td></tr>
<tr class="separator:ga216b4943aa8bcffd6eb685ce7c2b6a95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaac05ad889f09b6e8ef43503ba475a21f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#gaac05ad889f09b6e8ef43503ba475a21f">cy_buffer_release</a> (whd_buffer_t buffer, whd_buffer_dir_t direction)</td></tr>
<tr class="memdesc:gaac05ad889f09b6e8ef43503ba475a21f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Releases a packet buffer.  <a href="group__group__bsp__network__buffer.html#gaac05ad889f09b6e8ef43503ba475a21f">More...</a><br /></td></tr>
<tr class="separator:gaac05ad889f09b6e8ef43503ba475a21f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5c044b14f52500d9c41f18be0c3187c3"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga5c044b14f52500d9c41f18be0c3187c3">cy_buffer_get_current_piece_data_pointer</a> (whd_buffer_t buffer)</td></tr>
<tr class="memdesc:ga5c044b14f52500d9c41f18be0c3187c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves the current pointer of a packet buffer.  <a href="group__group__bsp__network__buffer.html#ga5c044b14f52500d9c41f18be0c3187c3">More...</a><br /></td></tr>
<tr class="separator:ga5c044b14f52500d9c41f18be0c3187c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9890010d1a7246a440477d47dc2c7b2b"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga9890010d1a7246a440477d47dc2c7b2b">cy_buffer_get_current_piece_size</a> (whd_buffer_t buffer)</td></tr>
<tr class="memdesc:ga9890010d1a7246a440477d47dc2c7b2b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves the size of a packet buffer.  <a href="group__group__bsp__network__buffer.html#ga9890010d1a7246a440477d47dc2c7b2b">More...</a><br /></td></tr>
<tr class="separator:ga9890010d1a7246a440477d47dc2c7b2b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7ed801ae7e748590d847c5ee3847dda1"><td class="memItemLeft" align="right" valign="top">whd_result_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga7ed801ae7e748590d847c5ee3847dda1">cy_buffer_set_size</a> (whd_buffer_t buffer, uint16_t size)</td></tr>
<tr class="memdesc:ga7ed801ae7e748590d847c5ee3847dda1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the current size of a WHD packet.  <a href="group__group__bsp__network__buffer.html#ga7ed801ae7e748590d847c5ee3847dda1">More...</a><br /></td></tr>
<tr class="separator:ga7ed801ae7e748590d847c5ee3847dda1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa284f33e6c96712370302d61d4b7cd58"><td class="memItemLeft" align="right" valign="top">whd_result_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#gaa284f33e6c96712370302d61d4b7cd58">cy_buffer_add_remove_at_front</a> (whd_buffer_t *buffer, int32_t add_remove_amount)</td></tr>
<tr class="memdesc:gaa284f33e6c96712370302d61d4b7cd58"><td class="mdescLeft">&#160;</td><td class="mdescRight">Moves the current pointer of a packet buffer.  <a href="group__group__bsp__network__buffer.html#gaa284f33e6c96712370302d61d4b7cd58">More...</a><br /></td></tr>
<tr class="separator:gaa284f33e6c96712370302d61d4b7cd58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3299898b9eba8861438225b85f36f528"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__bsp__network__buffer.html#ga3299898b9eba8861438225b85f36f528">cy_network_process_ethernet_data</a> (whd_interface_t interface, whd_buffer_t buffer)</td></tr>
<tr class="memdesc:ga3299898b9eba8861438225b85f36f528"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called by WHD to pass received data to the network stack.  <a href="group__group__bsp__network__buffer.html#ga3299898b9eba8861438225b85f36f528">More...</a><br /></td></tr>
<tr class="separator:ga3299898b9eba8861438225b85f36f528"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga71ccfd14f0c40804d555ccfb901b9d4f" name="ga71ccfd14f0c40804d555ccfb901b9d4f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga71ccfd14f0c40804d555ccfb901b9d4f">&#9670;&nbsp;</a></span>cy_buffer_enable_dynamic_buffers()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">whd_result_t cy_buffer_enable_dynamic_buffers </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__bsp__network__buffer.html#ga8aa3a6c010a110639b3cd53f86a7e349">cy_dynamic_buffer_allocate_t</a>&#160;</td>
          <td class="paramname"><em>buffer_allocate</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__bsp__network__buffer.html#gae058fc994c2d0d8c9960e68bbae86258">cy_dynamic_buffer_free_t</a>&#160;</td>
          <td class="paramname"><em>buffer_free</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable dynamic buffers for IOCTLs requiring large buffers. </p>
<p >Set the functions used to enable the allocation of dynamic buffers.</p>
<p >NetX Duo uses fixed sized buffers in the packet pool implementation. Some WHD IOCTL calls require buffers with payloads larger than the MAX_MTU size used for the packet pools. This API allows functions to be set which will allocate and free dynamic buffers as needed to support the large buffer IOCTLs.</p>
<p >NOTE: This API is specific to the NetX Duo implementation.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer_allocate</td><td>: Pointer to the function for allocating dynamic packets </td></tr>
    <tr><td class="paramname">buffer_free</td><td>: Pointer to the function for releasing dynamic packets</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: CY_RSLT_SUCCESS or WHD_BADARG </dd></dl>

</div>
</div>
<a id="ga6f5114fb8aa816f28ccb6370507c36c4" name="ga6f5114fb8aa816f28ccb6370507c36c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6f5114fb8aa816f28ccb6370507c36c4">&#9670;&nbsp;</a></span>cy_buffer_pool_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">whd_result_t cy_buffer_pool_init </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>tx_packet_pool</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>rx_packet_pool</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the buffer pools. </p>
<p >Initialize the buffer pools used by the buffer management routines. A pair of pools, one for RX buffers and one for TX buffers in passed in for use by the management routines.</p>
<p >Not all implementations use preallocated buffer pools.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tx_packet_pool</td><td>: Pointer to the initialized NetXDuo TX packet buffer pool </td></tr>
    <tr><td class="paramname">rx_packet_pool</td><td>: Pointer to the initialized NetXDuo RX packet buffer pool</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: CY_RSLT_SUCCESS or WHD_BADARG </dd></dl>

</div>
</div>
<a id="ga216b4943aa8bcffd6eb685ce7c2b6a95" name="ga216b4943aa8bcffd6eb685ce7c2b6a95"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga216b4943aa8bcffd6eb685ce7c2b6a95">&#9670;&nbsp;</a></span>cy_host_buffer_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">whd_result_t cy_host_buffer_get </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">whd_buffer_dir_t&#160;</td>
          <td class="paramname"><em>direction</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeout_ms</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Allocates a packet buffer. </p>
<p >Attempts to allocate a packet buffer of the size requested. It can do this by allocating a pre-existing packet from a pool, using a static buffer, or by dynamically allocating memory. The method of allocation does not concern WHD, however it must match the way the network stack expects packet buffers to be allocated. Usually WHD requires packet of size of WHD_LINK_MTU which includes the MTU. Refer to whd_types.h to find the size of WHD_LINK_MTU.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: A pointer which receives the allocated packet buffer handle </td></tr>
    <tr><td class="paramname">direction</td><td>: Indicates transmit/receive direction that the packet buffer is used for. This may be needed if tx/rx pools are separate. </td></tr>
    <tr><td class="paramname">size</td><td>: The number of bytes to allocate. </td></tr>
    <tr><td class="paramname">timeout_ms</td><td>Time to wait for a packet buffer to be available</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: CY_RSLT_SUCCESS or WHD_BUFFER_ALLOC_FAIL if the buffer could not be allocated </dd></dl>

</div>
</div>
<a id="gaac05ad889f09b6e8ef43503ba475a21f" name="gaac05ad889f09b6e8ef43503ba475a21f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaac05ad889f09b6e8ef43503ba475a21f">&#9670;&nbsp;</a></span>cy_buffer_release()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cy_buffer_release </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">whd_buffer_dir_t&#160;</td>
          <td class="paramname"><em>direction</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Releases a packet buffer. </p>
<p >This function is used by WHD to indicate that it no longer requires a packet buffer. The buffer can then be released back into a pool for reuse, or the dynamically allocated memory can be freed, according to how the packet was allocated. Returns void since WHD cannot do anything about failures</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: The handle of the packet buffer to be released </td></tr>
    <tr><td class="paramname">direction</td><td>: Indicates transmit/receive direction that the packet buffer has been used for. This might be needed if tx/rx pools are separate. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga5c044b14f52500d9c41f18be0c3187c3" name="ga5c044b14f52500d9c41f18be0c3187c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5c044b14f52500d9c41f18be0c3187c3">&#9670;&nbsp;</a></span>cy_buffer_get_current_piece_data_pointer()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t * cy_buffer_get_current_piece_data_pointer </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves the current pointer of a packet buffer. </p>
<p >Since packet buffers usually need to be created with space at the front for additional headers, this function allows WHD to get the current 'front' location pointer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: The handle of the packet buffer whose pointer is to be retrieved</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: The packet buffer's current pointer. </dd></dl>

</div>
</div>
<a id="ga9890010d1a7246a440477d47dc2c7b2b" name="ga9890010d1a7246a440477d47dc2c7b2b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9890010d1a7246a440477d47dc2c7b2b">&#9670;&nbsp;</a></span>cy_buffer_get_current_piece_size()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t cy_buffer_get_current_piece_size </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves the size of a packet buffer. </p>
<p >Since packet buffers usually need to be created with space at the front for additional headers, the memory block used to contain a packet buffer will often be larger than the current size of the packet buffer data. This function allows WHD to retrieve the current size of a packet buffer's data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: The handle of the packet buffer whose size is to be retrieved</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: The size of the packet buffer. </dd></dl>

</div>
</div>
<a id="ga7ed801ae7e748590d847c5ee3847dda1" name="ga7ed801ae7e748590d847c5ee3847dda1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7ed801ae7e748590d847c5ee3847dda1">&#9670;&nbsp;</a></span>cy_buffer_set_size()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">whd_result_t cy_buffer_set_size </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the current size of a WHD packet. </p>
<p >This function sets the current length of a WHD packet buffer</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: The packet to be modified </td></tr>
    <tr><td class="paramname">size</td><td>: The new size of the packet buffer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: CY_RSLT_SUCCESS or WHD_BUFFER_SIZE_SET_ERROR if the requested size is not valid </dd></dl>

</div>
</div>
<a id="gaa284f33e6c96712370302d61d4b7cd58" name="gaa284f33e6c96712370302d61d4b7cd58"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa284f33e6c96712370302d61d4b7cd58">&#9670;&nbsp;</a></span>cy_buffer_add_remove_at_front()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">whd_result_t cy_buffer_add_remove_at_front </td>
          <td>(</td>
          <td class="paramtype">whd_buffer_t *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>add_remove_amount</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Moves the current pointer of a packet buffer. </p>
<p >Since packet buffers usually need to be created with space at the front for additional headers, this function allows WHD to move the current 'front' location pointer so that it has space to add headers to transmit packets, and so that the network stack does not see the internal WHD headers on received packets.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>: A pointer to the handle of the current packet buffer for which the current pointer will be moved. On return this may contain a pointer to a newly allocated packet buffer which has been daisy chained to the front of the given one. This would be the case if the given packet buffer didn't have enough space at the front. </td></tr>
    <tr><td class="paramname">add_remove_amount</td><td>: This is the number of bytes to move the current pointer of the packet buffer - a negative value increases the space for headers at the front of the packet, a positive value decreases the space.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>: CY_RSLT_SUCCESS or WHD_BUFFER_POINTER_MOVE_ERROR if the added amount is outside the size of the buffer </dd></dl>

</div>
</div>
<a id="ga3299898b9eba8861438225b85f36f528" name="ga3299898b9eba8861438225b85f36f528"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3299898b9eba8861438225b85f36f528">&#9670;&nbsp;</a></span>cy_network_process_ethernet_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cy_network_process_ethernet_data </td>
          <td>(</td>
          <td class="paramtype">whd_interface_t&#160;</td>
          <td class="paramname"><em>interface</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">whd_buffer_t&#160;</td>
          <td class="paramname"><em>buffer</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Called by WHD to pass received data to the network stack. </p>
<p >Packets received from the Wi-Fi network by WHD are forwarded to by calling function ptr which must be implemented in the network interface. Ethernet headers are present at the start of these packet buffers.</p>
<p >This function is called asynchronously in the context of the WHD thread whenever new data has arrived. Packet buffers are allocated within WHD, and ownership is transferred to the network stack. The network stack or application is thus responsible for releasing the packet buffers. Most packet buffering systems have a pointer to the 'current point' within the packet buffer. When this function is called, the pointer points to the start of the Ethernet header. There is other inconsequential data before the Ethernet header.</p>
<p >It is preferable that the (whd_network_process_ethernet_data)() function simply puts the received packet on a queue for processing by another thread. This avoids the WHD thread being unnecessarily tied up which would delay other packets being transmitted or received.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">interface</td><td>: The interface on which the packet was received. </td></tr>
    <tr><td class="paramname">buffer</td><td>: Handle of the packet which has just been received. Responsibility for releasing this buffer is transferred from WHD at this point. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>WiFi Host Driver Board Support Package Integration (whd-bsp-integration)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
